import java.util.Comparator;


public class JobComparator implements Comparator<Job>
{
	@Override
	public int compare(Job j1, Job j2) 
	{
		if(j1.getRelease() == j2.getRelease())
		{
			if(j1.getOwner().getPriority() == j2.getOwner().getPriority())
			{
				return j1.getOwner().getId() - j2.getOwner().getId();
			}
			return j1.getOwner().getPriority() - j2.getOwner().getPriority();
		}
		return j1.getRelease() - j2.getRelease();
	}

}
